package com.flying.cms.api;

import java.util.Date;

import com.flying.common.annotation.DaoCreate;
import com.flying.common.annotation.DaoQuery;
import com.flying.common.annotation.DaoRemove;
import com.flying.common.annotation.DaoUpdate;
import com.flying.framework.annotation.MethodInfo;
import com.flying.framework.annotation.Param;
import com.flying.framework.annotation.Service;
import com.flying.framework.data.Data;
import com.flying.framework.service.AbstractService;

@Service("api.category")
public class Category  extends AbstractService{
	
	@MethodInfo("根据栏目主键查询（包括子栏目）")
	@DaoQuery(entity="v_category", single=true)
	public Data findByCategoryId(

			@Param(value="category_id", required=true, desc="栏目ID") int category_id
		
		) throws Exception {
		return null;
	}

	@MethodInfo("根据代码查询（包括子栏目）")
	@DaoQuery(entity="v_category", single=true)
	public Data findByCodeWithChildren(

			@Param(value="code", required=true, desc="栏目代码") String code
		
		) throws Exception {
		return null;
	}

	@MethodInfo("根据代码查询（不包括子栏目）")
	@DaoQuery(entity="t_category", single=true)
	public Data findByCode(

			@Param(value="code", required=true, desc="栏目代码") String code
		
		) throws Exception {
		return null;
	}

	@MethodInfo("根据代码查询（包括栏目内容）")
	@DaoQuery(entity="v_category_contents", single=true)
	public Data findByCodeWithContents(

			@Param(value="code", required=true, desc="栏目代码") String code
		
		) throws Exception {
		return null;
	}

	@MethodInfo("根据父栏目ID查询（包括子栏目）")
	@DaoQuery(entity="v_category", osql="order by sort_id")
	public Data findByParentId(

			@Param(value="parent_id", required=true, desc="父栏目ID（0：从根开始查）") int parent_id
		
		) throws Exception {
		return null;
	}

	//-----------------------------------------------------------
	
	@MethodInfo("创建新对象")
	@DaoCreate(entity="t_category")
	public Data create(
		
			@Param(value="parent_id", required=false, desc="父栏目ID") int parent_id,
			@Param(value="code", required=false, desc="栏目代码") String code,
			@Param(value="name", required=false, desc="栏目名称") String name,
			@Param(value="icon", required=false, desc="图片") String icon,
			@Param(value="desc", required=false, desc="说明") String desc,
			@Param(value="xfields", required=false, desc="扩展字段（f1=xx;）") String xfields,
			@Param(value="keywords", required=false, desc="栏目关键词") String keywords,
			@Param(value="sort_id", required=false, desc="排序") int sort_id,
			@Param(value="contents", required=false, desc="内容数量") int contents,
			@Param(value="read_count", required=false, desc="阅读次数") int read_count,
			@Param(value="del_flag", required=false, desc="是否删除（0：未；1：已删除）") int del_flag,
			@Param(value="creator", required=false, desc="创建人") String creator,
			@Param(value="updator", required=false, desc="修改人") String updator,
			@Param(value="create_date", required=false, desc="创建时间") Date create_date,
			@Param(value="update_date", required=false, desc="修改时间") Date update_date
		
		) throws Exception {
		
		return null;
	}

	@MethodInfo("修改对象")
	@DaoUpdate(entity="t_category")
	public Data update(
		
			@Param(value="category_id", required=true, desc="栏目ID") int category_id,
			@Param(value="parent_id", required=false, desc="父栏目ID") int parent_id,
			@Param(value="code", required=false, desc="栏目代码") String code,
			@Param(value="name", required=false, desc="栏目名称") String name,
			@Param(value="icon", required=false, desc="图片") String icon,
			@Param(value="desc", required=false, desc="说明") String desc,
			@Param(value="xfields", required=false, desc="扩展字段（f1=xx;）") String xfields,
			@Param(value="keywords", required=false, desc="栏目关键词") String keywords,
			@Param(value="sort_id", required=false, desc="排序") int sort_id,
			@Param(value="contents", required=false, desc="内容数量") int contents,
			@Param(value="read_count", required=false, desc="阅读次数") int read_count,
			@Param(value="del_flag", required=false, desc="是否删除（0：未；1：已删除）") int del_flag,
			@Param(value="creator", required=false, desc="创建人") String creator,
			@Param(value="updator", required=false, desc="修改人") String updator,
			@Param(value="create_date", required=false, desc="创建时间") Date create_date,
			@Param(value="update_date", required=false, desc="修改时间") Date update_date
		
		) throws Exception {
		
		return null;
	}

	@MethodInfo("删除对象")
	@DaoRemove(entity="t_category")
	public Data remove(

			@Param(value="category_id", required=true, desc="栏目ID") int category_id
		
		) throws Exception {
		
		return null;
	}

	@MethodInfo("查询所有对象")
	@DaoQuery(entity="t_category")
	public Data findAll() throws Exception {
		return null;
	}

}